<?php

$form = new Zend_Form;

$form->setAction('/resource/process')
     ->setMethod('post');

$form->setAttrib('id', 'login');


$form->addElement(new Zend_Form_Element_Text('username'));
$form->addElement('text', 'username');


$username = new Zend_Form_Element_Text('username');
$username->addValidator(new Zend_Validate_Alnum()); //walidacja formularza
$username->addValidator('regex', false, array('/^[a-z]/i'));     
$username->addFilter('StringtoLower');    
	
echo $form->render($view); // analogiczne wywolanie
echo $form;


# walidacja formularza polimorficzne wywolanie klasy walidującej
    
	if ($form->isValid($_POST)) {
        // success!
    } else {
        // failure!
    }
	
?>
